<?php
/**
 * User: jwj
 * Date: 2017/3/23
 * Time: 9:20
 * 地址表
 */
defined('InNcPHP') or exit('Access Invalid!');

class areaModel extends Model{

    public function __construct(){
        parent::__construct('area');
    }

    public function getAreaInfo($condition = array(), $field = '*'){
        return $this->field($field)->where($condition)->find();
    }

    public function getAreaList($condition = array(), $field = '*', $order = 'area_id asc'){
        return $this->field($field)->where($condition)->order($order)->select();
    }
    //获取地区名字
    public function getfby_id($id)
    {
        $res = $this->field('name')->where(array('area_id'=>$id))->find();
        if(!empty($res)){
            return $res['name'];
        }
        return;
    }
}
